BIN=stdbin/non-output/riscv-tests/addi-riscv-tests.bin
# TEST_CASES=stdbin/non-output/riscv-tests 
TEST_CASES=stdbin/non-output/cpu-tests

DUMP_TOOL = gtkwave
DUMP_FLAGS= ?
ifeq ($(DUMP_TOOL) , gtkwave)
DUMP_FLAGS = +dump-vcd
endif
ifeq ($(DUMP_TOOL) , verdi)
DUMP_FLAGS = +dump-wave
endif

vcs:
	make -C $(CCTP_HOME)/difftest

run: 
	$(CCTP_HOME)/difftest/simv +workload=$(BIN)  

regression:clean-regression
	$(CCTP_HOME)/regression.sh -r $(TEST_CASES) > regression.end

dump:
	$(CCTP_HOME)/difftest/simv +workload=$(BIN) $(DUMP_FLAGS)

wave:
	$(DUMP_TOOL) simv.vcd

# verdi:
# 	make -C $(CCTP_HOME)/difftest verdi

all:vcs run 
all_dump:vcs dump 

clean-run:
	@ rm -rf stack.info.*

clean-regression: clean-run
	@ rm -f  regression.end
	@ rm -rf  log

clean:clean-regression
	@make -C $(CCTP_HOME)/difftest clean
	@rm -rf vc_hdrs.h ucli.key  vcdplus.vpd novas_dump.log novas.rc novas.conf *.fsdb *.vcd verdiLog
